/**
 * Created by Admin on 2017/12/26.
 */
define(function (require, exports, module) {
    var commonPaging=require("../common/commonPaging");
    var v1 =require("../system/classify.validator");
    var myWidGet = require("../common/myWidGet");
    var areaTpl=require("./tpl/areaTpl.html");
    require("../common/dialog");
    require("../seajs-init");

    var p=new commonPaging({
        htmlContainer: "#Js_page_content",
        pageContainer: "#Js_fs_paging",
        url: window.jkconfig.webapiurlv+"typemanage/pagequeryareas",
        tpl:areaTpl
    });
    p.init();
    var fatherBody = $(window.top.document.body);
    var editAreaForm = fatherBody.find("#editAreaForm");
    v1.editValidator(editAreaForm);//添加区域

    $(function() {
        $("#platformName").html(platformName);
        var fatherBody = $(window.top.document.body);//找到父页面的body对象
        $("body").on("click",".btnAddArea",function() {
            fatherBody.find("#modal-addArea").show();
            fatherBody.find("#modal-addArea .modal-header label").html("添加区域管理");
            fatherBody.find("input[name=sort]").val("");
            fatherBody.find("input[name=name]").val("");
            fatherBody.find("input[name=id]").val("");
        }).on("click", ".btnAreaUpdate", function () {        //修改区域
            fatherBody.find("#modal-addArea").show();
            fatherBody.find("#modal-addArea .modal-header label").html("编辑区域管理");
            fatherBody.find("input[name=sort]").val($(this).attr("data-no"));
            fatherBody.find("input[name=name]").val($(this).attr("data-name"));
            fatherBody.find("input[name=id]").val($(this).attr("data-id"));
            // v1.editValidator(editAreaForm);//添加区域
        }).on("click", ".btnAreaRemove", function () {
            fatherBody.find("#deletAreaModal .selectedArea").html($(this).attr("data-name")).attr("data-id",$(this).attr("data-id"));
            fatherBody.find("#deletAreaModal").show();
        })

    })
})